#ifndef OHLC_H
#define OHLC_H

#include <QString>

class OHLCVItem
{
public:
    OHLCVItem(QString *stockName, double open, double high, double low, double close, double volume, uint unixdate);
    OHLCVItem(): open(0.0), high(0.0), low(0.0), close(0.0), volume(0.0)
    {
        this->unixdate = 0;
        this->stockName = QString();
    }

    //ordena pelo nome e depois pela data. coisa linda.
    bool operator<(OHLCVItem const & other) const
    {
        if (this->stockName.toLower() == other.stockName.toLower()){
            return this->unixdate < other.unixdate;
        }
        else{
            return this->stockName.toLower() < other.stockName.toLower();
        }
    }

    //operador de igualdade
    bool operator==(OHLCVItem const & other) const
    {
        return (
                this->stockName.toLower() == other.stockName.toLower() &&
                this->open     == other.open &&
                this->high     == other.high &&
                this->low      == other.low  &&
                this->close    == other.close &&
                this->volume   == other.volume &&
                this->unixdate == other.unixdate
                );
    }


    double open, high, low, close, volume;
    uint unixdate; //unix date
    QString stockName;


};



#endif // OHLC_H
